﻿// copyright jyz.2024

#pragma once

#include "CoreMinimal.h"
#include "Abilities/Tasks/AbilityTask.h"
#include "TargetDataUnderMouse.generated.h"

DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FTargetDataUnderMouseSignature,const FGameplayAbilityTargetDataHandle&,DataHandle);
/**
 * 获取与鼠标光标下的点击结果相关的数据
 */
UCLASS()
class AURARPGDEMO_API UTargetDataUnderMouse : public UAbilityTask
{
	GENERATED_BODY()
public:
	UFUNCTION(BlueprintCallable, Category="Ability|Tasks", meta = (DisplayName="TargetDataUnderMouse",
		HidePin = "OwningAbility", DefaultToSelf = "OwningAbility", BlueprintInternalUseOnly = "TRUE"))
	static UTargetDataUnderMouse* CreateTargetDataUnderMouse(UGameplayAbility* OwningAbility);

	UPROPERTY(BlueprintAssignable)
	FTargetDataUnderMouseSignature ValidData;
protected:
	virtual void Activate() override;
private:
	void SendMouseCursorData() const;
	void OnTargetDataReplicatedCallback( const FGameplayAbilityTargetDataHandle& DataHandle, FGameplayTag GameplayTag) const;
};
